using System.Collections;
using System.Security.Principal;

namespace ThunderJob.Controllers.Security
{
    public interface IUserPrincipal : IPrincipal
    {
        IUserIdentity EmpresaIdentity { get; set; }
    }

    public class UserPrincipal : IUserPrincipal
    {
        public IList Roles { get; private set; }

        public UserPrincipal(IUserIdentity empresaIdentity, IList roles)
        {
            EmpresaIdentity = empresaIdentity;
            Roles = roles;
        }

        public bool IsInRole(string role)
        {
            return Roles.Contains(role);
        }

        public IUserIdentity EmpresaIdentity { get; set; }

        public IIdentity Identity
        {
            get { return EmpresaIdentity; }
        }

    }
}